﻿@using MvcJqGrid
@{
    ViewBag.Title = "Party";
}
@section Scripts
{
    <script type="text/javascript">
        function EditDeleteParty(cellvalue, options, rowobject) {
            return '<a onclick="return MenufacturerDetails(' + options.rowId + ')" href="#"><div class="ui-icon ui-icon-pencil" style="display:inline-block"></div></a>' +
                   '<a onclick="return DeleteMenufacturer(' + options.rowId + ')" href="#"><div class="ui-icon ui-icon-trash" style="display:inline-block"></div></a>';
        }
    </script>
}
<div id="dialogEdit" style="display: none">
</div>

<div id="dialogConfirm" title="Delete Party" style="display: none">
    <p>
        <span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 20px 0;"></span>
        Are you sure to delete ?
    </p>
</div>

<a href="@Url.Action("ProductDetails", "Inventory")">Create party</a>

@(Html.Grid("PartyGrid")
    .SetRequestType(MvcJqGrid.Enums.RequestType.Post)
    .SetJsonReader(new MvcJqGrid.DataReaders.JsonReader { Id = "ID", RepeatItems = false })
    .SetAutoWidth(true)
    .SetRowNumbers(true)
    .SetShowAllSortIcons(true)
    .SetToolbar(true)
    .SetToolbarPosition(ToolbarPosition.Bottom)
    .SetFooterRow(true)
    .SetHeaderTitles(true)
    .SetCaption("Party")
    .AddColumn(new Column("Name").SetLabel("Name"))
    .AddColumn(new Column("Phone").SetAlign(Align.Right))
    .AddColumn(new Column("Email"))
    .AddColumn(new Column("CreditLimit").SetAlign(Align.Right))
    .AddColumn(new Column("Balance").SetAlign(Align.Right))
    .AddColumn(new Column("Address").SetAlign(Align.Right))
    .AddColumn(new Column("ModeOfPayment"))
    .AddColumn(new Column("PartyStatus"))
    .AddColumn(new Column("Action").SetSearch(false).SetCustomFormatter("EditDeleteParty")
                                    .SetWidth(50)
                                    .SetAlign(Align.Right).SetSortable(false))
    .SetUrl(Url.Action("PartyGrid", "Party"))
    .SetAutoWidth(true)
    .SetRowNum(10)
    .SetRowList(new[] { 10, 15, 20, 50 })
    .SetViewRecords(true)
    .SetPager("pager")
    )
